/*
  command.h
    Define a set of function & marco to the command moudle
  BeginnerC
 */
#ifndef COMMAND_H
#define COMMAND_H
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
#include <stdbool.h>
#define MAX_COMMAND_LENGTH 16
/*
  Command
    Describle the relationship of the command and handle function
  BeginnerC
 */
typedef struct Command
{
    char command[MAX_COMMAND_LENGTH];
    int (*handle)(void *argument);
    struct Command *next;
}Command;
/*
  CommandList
    The list of command-handle relations
  BeginnerC
 */
typedef struct CommandList
{
    Command *first;
    Command *last;
}CommandList;
/*
  MainArgument
    Describle the main function's argc & argv
  BeginnerC
 */
typedef struct MainArgument
{
    int argc;
    char **argv;
}MainArgument;
bool BindCommand(CommandList *list, const char *command, int (*handle)(void *argument));
CommandList* InitList();
void FreeList(CommandList* list);
int HandleCommand(CommandList* list, const char *command, void *argument);
#endif
